<%@page import="com.lrkj.back.entity.ZsEquip" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${ctx}/css/sapar.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common.css"/>
    <script type="text/javascript" src="${ctx}/js/jquery.js"></script>
    <script type="text/javascript" src="${ctx}/js/sapar.js"></script>
    <script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
    <script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
    <script type="text/javascript" src="${ctx}/js/kkpager.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/kkpager_blue.css"/>
    <script type="text/javascript" src="${ctx}/assets/laydate/laydate.js"></script>
    <script src="${ctx}/js/share.js" type="text/javascript"></script>
    <link rel="stylesheet" href="${ctx}/css/jquery-ui-1.9.2.custom.css" type="text/css">
    <script src="${ctx}/js/jquery-ui-1.9.2.custom.js" type="text/javascript" language="javascript"></script>

    <title>追溯功能</title>
    <style type="text/css">
        /*.tab {*/
            /*background-color: white;*/
        /*}*/

        /*#txt {*/
            /*margin-top: -4px;*/
        /*}*/

        /*#txt1 {*/
            /*margin-top: 4px;*/
        /*}*/

        /*.nav_list {*/
            /*float: left*/
        /*}*/

        /*.nav_list ul {*/
            /*float: left*/
        /*}*/

        /*.nav_list ul li {*/
            /*float: left;*/
            /*padding: 0 10px;*/
            /*height: 30px;;*/
            /*line-height: 30px;*/
            /*font-size: 14px;*/
            /*color: #333*/
        /*}*/

        /*.nav_list ul li.native {*/
            /*background-color: #6ab96e;*/
            /*color: #fff*/
        /*}*/

        th {
            text-align: center;
        }

        td {
            text-align: center;
        }

        .wcz {
            color: red;
        }
    </style>

</head>
<body>
<div>
    <div class="subfiled clearfix">
        <h2>追溯功能</h2>
    </div>
    <div class="subfiled-content">
        <div class="search-box clearfix">
            <div class="kv-item clearfix" id="txt">
                <label>搜索条件：</label>
                <div class="kv-item-content" id="txt1">
                    <input type="text" id="searchTxt" name="searchTxt" placeholder="包条码/包名"
                           value="${searchTxt}" class="search_text">
                </div>
            </div>

            <%--<div class="kv-item clearfix" id="shijian">--%>
            <%--<select id="tiaojianone">--%>
            <%--<option value="" >选择时间类型</option>--%>
            <%--<option value="huishouTime">回收时间</option>--%>
            <%--<option value="qingxiKaishiTime">清洗时间</option>--%>
            <%--<option value="peibaoTime">配包时间</option>--%>
            <%--<option value="miejunKaishiTime">灭菌时间</option>--%>
            <%--<!--  <option value="patientId">发放时间</option> -->--%>
            <%--<option value="shiyongTime">使用时间</option>--%>
            <%--</select>--%>
            <%--</div>--%>
            <div class="kv-item-content" style="margin-left: 20px; ">
                <input style="padding-left: 32px ;padding-right: 8px" name="time" id="time" type="text"
                       class="ui-datepicker-time"/>
                <div class="ui-datepicker-css">
                    <div class="ui-datepicker-quick">
                        <p>快捷日期<a class="ui-close-date">X</a></p>
                        <div>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="今天" alt="0"
                                   name=""/>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="昨天" alt="-1"
                                   name=""/>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="7天内"
                                   alt="-6" name=""/>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="14天内"
                                   alt="-13" name=""/>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="30天内"
                                   alt="-29" name=""/>
                            <input @click="timeChangeFun" class="ui-date-quick-button" type="button" value="60天内"
                                   alt="-59" name=""/>
                        </div>
                    </div>
                    <div class="ui-datepicker-choose">
                        <p>自选日期</p>
                        <div class="ui-datepicker-date">
                            <input @click="timeChangeFun" name="startDate" id="startDate" class="startDate" readonly
                                   value="2014/12/20" type="text">
                            -
                            <input @click="timeChangeFun" name="endDate" id="endDate" class="endDate" readonly
                                   value="2014/12/20" type="text" disabled onchange="datePickers()">

                        </div>
                    </div>
                </div>
            </div>

            <%--<div class="kv-item clearfix">--%>
            <%--<div class="kv-item-content">--%>
            <%--<span>&nbsp;&nbsp;&nbsp;起始时间:</span>--%>
            <%--<input type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" id="st" name="startTime"  readonly="readonly">--%>
            <%--<span>&nbsp;&nbsp;&nbsp;终止时间:</span>--%>
            <%--<input type="text" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" id="et" name="endTime"  readonly="readonly">--%>
            <%--</div>--%>
            <%--</div>--%>
            <a href="javascript:;" class="sapar-btn sapar-btn-recom query-btn">查询</a>
        </div>
    </div>
</div>
<div id="saper-container">
    <div class="subfiled-content">
        <div class="tab-container" data-trigger="click">
            <%--<div class="tab">--%>
            <%--<a href="javascript:;" class="current">基本信息</a>--%>
            <%--<a href="javascript:;">回收信息</a>--%>
            <%--<a href="javascript:;">清洗信息</a>--%>
            <%--<a href="javascript:;">配包信息</a>--%>
            <%--<a href="javascript:;">灭菌信息</a>--%>
            <%--<a href="javascript:;">发放信息</a>--%>
            <%--<a href="javascript:;">使用信息</a>--%>
            <%--</div>--%>
            <div class="tab-content">
                <!--表格具体内容-->
                <div class="tab-content-item">
                    <div class="table">
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>包名</th>
                                    <th>所属科室</th>
                                    <th>流程状态</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <td>${dabao.packageName}</td>
                                            <td>
                                                <c:if test="${dabao.tbPackageMuban.tbDepartment != null}">${dabao.tbPackageMuban.tbDepartment.departmentName}</c:if>
                                                <c:if test="${dabao.tbPackageMuban.tbDepartment == null}">
                                                    <c:if test="${dabao.tbPackageMuban.packageDepartid == 16 }">--</c:if>
                                                    <c:if test="${dabao.tbPackageMuban.packageDepartid == 17 }">厂家</c:if>
                                                </c:if>
                                            </td>
                                            <td>${dabao.tbPackageMuban.packageFunction}</td>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!--表格结束-->
                <div class="tab-content-item">
                    <div class="table">
                        <!--表格具体内容-->
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>交接人姓名</th>
                                    <th>回收人姓名</th>
                                    <!-- <th>回收网篮条码</th> -->
                                    <th>回收时间</th>
                                    <th>回收状态</th>
                                    <!-- <th>同一个回收网篮的包</th> -->
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <c:if test="${dabao.huishouLiushui != null }">
                                                <td>${empmap[dabao.huishouJiaojierenTiaoma]}</td>
                                                <td>${empmap[dabao.huishouHuishourenTiaoma]}</td>
                                                <%-- <td>${dabao.huishouWanglanTiaoma}</td> --%>
                                                <td><fmt:formatDate value="${dabao.huishouTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td><c:if test="${dabao.huishouAllzhuangtai==0}">未完成</c:if>
                                                    <c:if test="${dabao.huishouAllzhuangtai==1}">完成</c:if>
                                                    <c:if test="${dabao.huishouAllzhuangtai==2}">清洗完成</c:if>
                                                </td>
                                                <%-- <td><a href="javascript:;" class="huishouwanglan" value="${dabao.huishouWanglanTiaoma}">查看详细</a></td> --%>
                                            </c:if>
                                            <c:if test="${dabao.huishouLiushui == null }">
                                                <td><span class="wcz">未回收</span></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!--表格结束-->
                </div>
                <div class="tab-content-item">
                    <!--表格具体内容-->
                    <div class="table">
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>清洗设备条码</th>
                                    <th>清洗设备名字</th>
                                    <th>清洗软件名字</th>
                                    <th>清洗人</th>
                                    <th>清洗开始时间</th>
                                    <th>清洗结束时间</th>
                                    <th>清洗审核人</th>
                                    <th>清洗审核时间</th>
                                    <th>清洗审核状态</th>
                                    <!-- <th>一起清洗的包</th> -->
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <c:if test="${dabao.qingxiLiushui != null }">
                                                <td>${dabao.qingxiShebeiTiaoma}</td>
                                                <td>${equipmap[dabao.qingxiShebeiTiaoma+0].equipName}</td>
                                                <td>${softmap[dabao.qingxiRuanjianTiaoma+0].softName}</td>
                                                <td>${empmap[dabao.qingxiQingxirenTiaoma] }</td>
                                                <td><fmt:formatDate value="${dabao.qingxiKaishiTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td><fmt:formatDate value="${dabao.qingxiJieshuTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td>${empmap[dabao.qingxiShenherenTiaoma]}</td>
                                                <td><fmt:formatDate value="${dabao.qingxiShenherenTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td><c:if test="${dabao.qingxiHege==2}">不合格</c:if>
                                                    <c:if test="${dabao.qingxiHege==1}">合格</c:if>
                                                    <c:if test="${dabao.qingxiZhuangtai==2 }">
                                                        <c:if test="${dabao.qingxiHege==0}">未审核</c:if>
                                                    </c:if></td>
                                                <%-- <td><a href="javascript:;" class="qingxibao" value="${dabao.qingxiLiushui }">查看详细</a></td> --%>
                                            </c:if>
                                            <c:if test="${dabao.qingxiLiushui == null }">
                                                <td><span class="wcz">未清洗</span></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!--表格结束-->
                </div>
                <div class="tab-content-item">
                    <!--表格开始-->
                    <div class="table">

                        <!--表格具体内容-->
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>配包人</th>
                                    <th>配包时间</th>
                                    <th>配包审核人</th>
                                    <th>配包审核时间</th>
                                    <th>配包审核状态</th>
                                    <th>关包人</th>
                                    <th>关包时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <c:if test="${dabao.peibaoLiushui != null }">
                                            <td>${empmap[dabao.peibaoPiebaorenTiaoma]}</td>
                                            <td><fmt:formatDate value="${dabao.peibaoTime}"
                                                                type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                            <td>${empmap[dabao.peibaoShenherenTiaoma]}</td>
                                            <td><fmt:formatDate value="${dabao.peibaoShenherenTime}"
                                                                type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                            <td><c:if test="${dabao.peibaoHege==0}">不合格</c:if> <c:if
                                                    test="${dabao.peibaoHege==1}">合格</c:if></td>
                                            <td>${empmap[dabao.peibaoGuanbaoTiaoma]}</td>
                                            <td><fmt:formatDate value="${dabao.peibaoGuanbaoTime}"
                                                                type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                            <td>
                                                </c:if>
                                                <c:if test="${dabao.peibaoLiushui == null }">
                                            <td><span class="wcz">未配包</span></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="tab-content-item">
                    <!--表格开始-->
                    <div class="table">
                        <!--表格具体内容-->
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>灭菌设备条码</th>
                                    <th>灭菌设备名字</th>
                                    <th>灭菌程序</th>
                                    <th>灭菌人</th>
                                    <th>灭菌开始时间</th>
                                    <th>灭菌结束时间</th>
                                    <th>灭菌审核人</th>
                                    <th>灭菌审核结果</th>
                                    <th>灭菌状态</th>
                                    <th>一起灭菌的包</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <c:if test="${dabao.miejunLiushui != null }">
                                                <td>${dabao.miejunShebeiTiaoma}</td>
                                                <td>${equipmap[dabao.miejunShebeiTiaoma+0].equipName}</td>
                                                <td>${softmap[dabao.miejunRuanjianTiaoma+0].softName}</td>
                                                <td>${empmap[dabao.miejunMeijunrenTiaoma]}</td>
                                                <td><fmt:formatDate value="${dabao.miejunKaishiTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td><fmt:formatDate value="${dabao.miejunJieshuTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                                <td>${empmap[dabao.miejunShenherenTiaoma]}</td>
                                                <td><c:if test="${dabao.miejunHege==1}">不合格</c:if>
                                                    <c:if test="${dabao.miejunHege==3}">合格</c:if>
                                                    <c:if test="${dabao.miejunHege==2}">二审</c:if>
                                                </td>
                                                <td><c:if test="${dabao.miejunZhuangtai==0}">待灭菌</c:if>
                                                    <c:if test="${dabao.miejunZhuangtai==1}">灭菌中</c:if> <c:if
                                                            test="${dabao.miejunZhuangtai==2}">灭菌完成</c:if></td>
                                                <td><a href="javascript:;" class="miejunbao"
                                                       value="${dabao.miejunLiushui }">查看详细</a></td>
                                            </c:if>
                                            <c:if test="${dabao.miejunLiushui == null }">
                                                <td><span class="wcz">未灭菌</span></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td><a href="javascript:;" class="miejunbao"
                                                       value="${dabao.miejunLiushui }">查看详细</a></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="tab-content-item">
                    <div class="table">
                        <!--表格具体内容-->
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>发放人</th>
                                    <th>发放科室</th>
                                    <th>发放流水</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">
                                        <tr>
                                            <c:if test="${dabao.fafangLiushui != null }">
                                                <td>${empmap[dabao.fafangrenTiaoma]}</td>
                                                <td>
                                                    <c:if test="${dabao.fafangLiushui != null }">
                                                        <c:if test="${dabao.tbPackageMuban.packageDepartid != 17}">
                                                            ${dabao.wupinFafang.department.departmentName}
                                                        </c:if>
                                                        <c:if test="${dabao.tbPackageMuban.packageDepartid == 17}">厂家</c:if>
                                                    </c:if>
                                                </td>
                                                <td>${dabao.fafangLiushui}</td>
                                            </c:if>
                                            <c:if test="${dabao.fafangLiushui == null }">
                                                <td><span class="wcz">未发放</span></td>
                                                <td></td>
                                                <td></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!--表格结束-->
                </div>
                <div class="tab-content-item">
                    <!--表格开始-->
                    <div class="table">

                        <!--表格具体内容-->
                        <div class="table-box">
                            <table>
                                <thead>
                                <tr>
                                    <th>使用科室</th>
                                    <%--<th>使用病人编号</th>--%>
                                    <th>病人姓名</th>
                                    <th>住院号</th>
                                    <th>手术名</th>
                                    <th>使用时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:if test="${dabaoList != null}">
                                    <c:forEach items="${dabaoList}" var="dabao">

                                        <tr>
                                            <c:if test="${dabao.shiyongLiushui != null }">
                                                <td></td>
                                                <td>${dabao.patientId}</td>
                                                <td>${dabao.patientHospitalNo}</td>
                                                <td>${dabao.shoushuTemplate}</td>
                                                <td><fmt:formatDate value="${dabao.shiyongTime}"
                                                                    type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                            </c:if>
                                            <c:if test="${dabao.shiyongLiushui == null }">
                                                <td><span class="wcz">未使用</span></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                            </c:if>
                                        </tr>
                                    </c:forEach>
                                </c:if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!--表格结束-->
                </div>
            </div>
        </div>
    </div>
</div>
<div id="saper-ft">
    <div id="kkpager"></div>
</div>
</body>
<script type="text/javascript">
    $(function () {
        var totalPage = ${total};
        var pageNo = getParameter('pageIndex');
        if (!pageNo) {
            pageNo = 1;
        }
        //生成分页
        //有些参数是可选的，比如lang，若不传有默认值
        kkpager.generPageHtml({
            pno: pageNo,
            //总页码
            total: totalPage,
            //链接前部
            hrefFormer: '${ctx}/zhuisuPackage/packageingList',
            //链接尾部
            hrefLatter: '.do',
            getLink: function (n) {
                return this.hrefFormer + this.hrefLatter + "?pageIndex=" + n + "&searchTxt=" + $(".search_text").val();
            }
        });

        $(".query-btn").click(function () {
            var tiaojian = $(".search_text").val();
            var shijianleixin = $("#tiaojianone").val();
            var starttime = $("#st").val();
            var endtime = $("#et").val();
            var start = new Date(starttime.replace("-", "/").replace("-", "/"));
            var end = new Date(endtime.replace("-", "/").replace("-", "/"));
            if (end < start) {
                alert("终止时间不能在起始时间之前");
            }
            window.location.href = "${ctx}/zhuisuPackage/packageingList.do?searchTxt=" + $(".search_text").val() + "&leixin=" + shijianleixin + "&startTime=" + starttime + "&endTime=" + endtime;
        });

        $(".huishouwanglan").click(function () {
            var huishouwl = $(this).attr("value");
            layer.open({
                type: 2,
                title: '同一个网篮的包',
                maxmin: true,
                moveOut: true,

                shadeClose: true, //点击遮罩关闭层
                area: ['700px', '450px'],
                content: "${ctx}/zhuisuPackage/huishouwanglan.do?huishouwl=" + huishouwl
            });

        });

        $(".qingxibao").click(function () {
            var qingxibao = $(this).attr("value");
            layer.open({
                type: 2,
                title: '同一个网篮的包',
                maxmin: true,
                moveOut: true,

                shadeClose: true, //点击遮罩关闭层
                area: ['700px', '450px'],
                content: "${ctx}/zhuisuPackage/qingxibao.do?qingxibao=" + qingxibao
            });

        });

        $(".miejunbao").click(function () {
            var miejunbao = $(this).attr("value");
            layer.open({
                type: 2,
                title: '同一个网篮的包',
                maxmin: true,
                moveOut: true,
                shadeClose: true, //点击遮罩关闭层
                area: ['700px', '450px'],
                content: "${ctx}/zhuisuPackage/miejunbao.do?miejunbao=" + miejunbao
            });
        });
    })

    $(document).keydown(function (event) {
        var oPlay0 = document.getElementById("audio");
        var oPlay1 = document.getElementById("audio1");
        var packageName = $("input[name='packageName']").val();
        if (event.keyCode == 13) {
            if ($("#searchTxt").is(":focus")) {
                selectBytype();
            }
        }
    });


    function selectBytype() {
        $(".query-btn").click();
    }

    function getParameter(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }
</script>
</html>